package com.neutech.neuski.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.neutech.neuski.service.impl.SkiServiceImpl;
import com.neutech.po.Ski;


@Controller
@RequestMapping(value="/ski")
public class SkiController {
	@Autowired
	private SkiServiceImpl skiServiceImpl;
	@RequestMapping("/findSkiById")
	public @ResponseBody Ski getSki(Integer id){
		return skiServiceImpl.getSki(id);
		
	}
	@RequestMapping("/deleteSkiById")
	public @ResponseBody String delSki(Integer id) throws Exception{
		int result = skiServiceImpl.deleteSKI(id);
		if(result > 0){
			return "删除成功！";
		}else{
			return "删除失败，医技不存在。";
		}
	}
	@RequestMapping(value="/updateSki",method=RequestMethod.POST)
	public @ResponseBody String upSki(Ski ski) throws Exception{
		int result = skiServiceImpl.updateSki(ski);
		if(result > 0){
			return "修改成功！";
		}else{
			return "修改失败，医技不存在。";
		}
	}
	@RequestMapping(value="/insertSki",method=RequestMethod.POST)
	public @ResponseBody String insSki(Ski ski) throws Exception{
		int result = skiServiceImpl.insertSki(ski);
		if(result > 0){
			return "增加成功！";
		}else{
			return "增加失败，医技已存在。";
		}
	}
}
